<?php
/**
 * Created by Sven.
 * Date: 2016/12/16
 * Time: 10:42
 * 功能测试文件 test
 */

//define('ROOT_PATH',  dirname(__FILE__)); // D:\storm\CMS
//
//$_sxe = simplexml_load_file( ROOT_PATH . '/config/profile.xml' );
//$_taglib = $_sxe->xpath('/root/taglib');
//foreach ($_taglib as $taglib){
//    echo $taglib->name.'=>'.$taglib->value, '<br />';
//}

//ob_start();//开启缓冲区
//echo "这是第一次输出内容!\n";
//$ff[ 1 ] = ob_get_contents(); //获取当前缓冲区内容
//ob_flush();//缓冲器清除
//echo "这是第二次输出内容!\n";
//$ff[ 2 ] = ob_get_contents(); //获取当前缓冲区内容
//echo "这是第三次输出内容!\n";
//$ff[ 3 ] = ob_get_contents(); //获取当前缓冲区内容
//
//echo "<pre>";
//print_r( $ff );

//ob_flush(); // 清空缓冲区
//ob_end_flush(); //  输出全部内容并清空缓冲区
//ob_end_clean(); // 清除全部的内容，包括缓冲区和echo准备输出到浏览器的内容

//ob_start();
//echo 'heshiwei';
//ob_flush();
//$content = ob_get_contents();
//
//echo '<br />';
//var_dump($content);


//ob_start();
//phpinfo();
//$content = ob_get_contents();
//$fp = fopen('phpinfo.txt', 'w+');
//fwrite($fp, $content);
//fclose($fp);


//header('Location: index.html');
//
//ob_start();
//echo 'fdsfs';
//echo '<br />';
//$header = ob_get_contents();
//header('Content-Type: text/html; charset=utf-8');
//echo $header;

//ob_start();
//echo 'haha';
//$content = ob_get_contents();
//
//echo $content;
//ob_end_clean();

//$_patternInclude = '/{include\s+file=[\'\"]([\w-\.]+)[\'\"]}/';
//$_patternInclude = '/{include\s+file=([\"\'])([\w-\.\/]+)\1\}/';
//$str = <<<'EOF'
//{include file='templates/footer.tpl'}
//EOF;
//
//preg_match($_patternInclude, $str, $matchs);
//print_r($matchs);

// 测试 where id = sfada; 和 where id = 'fsfsd'; 的区别

//include 'includes/DB.class.php';
//
//$_mysqli = DB::getDB();
//
//$_id = 'fsdfds';
//
//$_sql = <<<E
//
//DELETE FROM cms_manage WHERE id = '$_id' ;
//
//E;
//
//var_dump($_sql);
//
//$_mysqli->query($_sql);
//$_affedted_rows = $_mysqli->affected_rows;
//echo '--';
//var_dump($_affedted_rows);
//echo '--';
//if ($_mysqli->errno){
//    echo $_mysqli->error;
//}

/*//$_pattern = '/\{\$([\w]+(\-\>[\w])*)\}/';
$_pattern = '/\{\$([\w]+)(\-\>([\w]+))*\}/'; // 支持 {$value}  {$obj->value}
$_content = <<<'EOF'
{$admin}

{$admin->admin_user}
EOF;

if ( preg_match( $_pattern, $_content ) ) {
    $_content = preg_replace( $_pattern, '<?php echo $this->_vars["$1"]$2; ?>', $_content );
}
echo $_content;*/


//echo $_SERVER['REQUEST_URI'];


//var_dump( strpos('http://www.baidu.com', 'ttt') );

//数组是值传递还是引用传递
// 值传递
/*$arr = array(1,2,3,4);
function page($arr){
    echo '----';
    var_dump($arr);
    unset($arr[0]);
    unset($arr[1]);
    unset($arr[2]);
    unset($arr[3]);
    var_dump($arr);
    echo '----';
}
page($arr);
var_dump($arr);
exit;

$arr = array('name'=>'hsw', 'pass'=>123,'page'=>1);
//unset($arr['name1']);
unset($arr['page']);
print_r($arr);
exit;

$url = '/admin/main_home_manage.php?page';
//$arr = parse_url($url);
//print_r($arr);

$arr = parse_url($url);
print_r($arr);
if (isset($arr['query'])){
    // 是否存在query
    parse_str($arr['query'], $params);
    print_r($params);
}*/

//
//include "includes/init.inc.php";
//
//$_vc = new ValidateCode();
//$_vc->doImage();

//session_start();

//include  'includes/init.inc.php';
//include "includes/ValidateCode.class.php";
//
//$_vc = new ValidateCode();
//$_vc->doImage();


//include dirname( __FILE__ ) . '/includes/init.inc.php';
//
//$_tpl->display('test.tpl');

//$html->key = 'fds';
//var_dump($html);

//$std = new stdClass();
//$std->key1 = '<em>fdafa</em>';
//$std->key2 = '<div>fsfs</div>';
//$arr = array( 'name' => '<strong>何世威</strong>', 'age'=> $std);
//$arr = Tool::htmlString($arr);
//print_r($arr);

/*
function demo($_data){
    return $_data. 'hahaha';
}

class Person {

    public function __set( $_key, $_val ) {
        $this->$_key = $_val;
    }

}

class Student {

    private $name;

    public function __set( $_key, $_val ) {
        $this->$_key = demo($_val);
    }

    public function __get($_key){
        return $this->$_key;
    }

}


$s = new Student();
$s->name = 'ss';
//echo $s->name;

$_s = '\'';

$_s = mysql_real_escape_string($_s);
echo $_s;*/

//ini_set('magic_quotes_gpc',"1");


//$c = $_POST['content'];
//var_dump($c);

//$_tpl->display('test.tpl');

//echo get_magic_quotes_gpc();

//$s = new stdClass();
//$s->ad = 'fssf';
//
//var_dump( intval($s) );

//phpinfo();

//echo $_SERVER["HTTP_REFERER"];

//echo $_SERVER['REMOTE_ADDR'];

//define('SDD', 'fdsf');
//var_dump( defined('SDD') );

//echo intval('fsdfsfsxxx**#$#');

//include dirname( __FILE__ ) . '/includes/init.inc.php';
//
//$_str = 'hesh\"wiei';
//echo $_str;
//echo stripslashes($_str);



//var_dump($_jsCode);


//echo strip_tags('adfa<img src >dddd');

//$arr = array('fs');
//echo implode(',', $arr);


//echo sha1('7c4a8d09ca3762af61e59520943dc26494f8941b');



//include dirname( __FILE__ ) . '/includes/init.inc.php';
//
//$var = Tool::mysqlString('<html>heihei</html>');

//echo $var;

//phpinfo();

//var_dump( intval('100') );

//$str = 'he';
//$array = explode(',',  $str);
//var_dump($array);

?>



